﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
using System.Data;
using MODEL;

namespace DAL
{
    public class AccountService
    {
        /// <summary>
        /// 登录的方法
        /// </summary>
        /// <param name="account">登录表的类 </param>
        /// <returns></returns>
        public static int Login(Account account)
        {
            string sql = "select*from Account where UserName=@UserName and Password=@Password";

            SqlParameter[] sp =
            {
                new SqlParameter("@UserName",account.UserName),
                new SqlParameter ("@Password",account.Password)
            };
            DataTable dt = SqlHelper.QueryMethod(sql, sp);

            int num = dt.Rows.Count;

            return num;//返回数据表的行数
        }
    }
}
